#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QPainter>
#include <QDebug>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::paintEvent(QPaintEvent *event)
{
    QPainter painter;
    painter.begin(this);
    painter.drawLine(0, 0, 200, 200);

    QPen pen(Qt::red, 5);
    pen.setStyle(Qt::DashLine);
    painter.setPen(pen);
    painter.drawLine(0, 50, 200, 250);
    painter.drawArc(50, 50, 50, 50, 30 * 16, 180 * 16);
    painter.drawRect(100, 50, 100, 100);
    QBrush brush(Qt::green);
    brush.setStyle(Qt::CrossPattern);
    painter.setBrush(brush);
    painter.drawEllipse(200, 50, 100, 50);
    painter.drawLine(250, 100, 250, 200);
    painter.drawText(200, 200, 100, 50, Qt::AlignCenter, "华清远见");

    painter.end();
}
